package com.ruoyi.project.system.moneydetail.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.moneydetail.mapper.UsersMoneydetailMapper;
import com.ruoyi.project.system.moneydetail.domain.UsersMoneydetail;
import com.ruoyi.project.system.moneydetail.service.IUsersMoneydetailService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 消费记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-03-01
 */
@Service
public class UsersMoneydetailServiceImpl implements IUsersMoneydetailService 
{
    @Autowired
    private UsersMoneydetailMapper usersMoneydetailMapper;

    /**
     * 查询消费记录
     * 
     * @param id 消费记录主键
     * @return 消费记录
     */
    @Override
    public UsersMoneydetail selectUsersMoneydetailById(Long id)
    {
        return usersMoneydetailMapper.selectUsersMoneydetailById(id);
    }

    /**
     * 查询消费记录列表
     * 
     * @param usersMoneydetail 消费记录
     * @return 消费记录
     */
    @Override
    public List<UsersMoneydetail> selectUsersMoneydetailList(UsersMoneydetail usersMoneydetail)
    {
        return usersMoneydetailMapper.selectUsersMoneydetailList(usersMoneydetail);
    }

    /**
     * 新增消费记录
     * 
     * @param usersMoneydetail 消费记录
     * @return 结果
     */
    @Override
    public int insertUsersMoneydetail(UsersMoneydetail usersMoneydetail)
    {
        usersMoneydetail.setCreateTime(DateUtils.getNowDate());
        return usersMoneydetailMapper.insertUsersMoneydetail(usersMoneydetail);
    }

    /**
     * 修改消费记录
     * 
     * @param usersMoneydetail 消费记录
     * @return 结果
     */
    @Override
    public int updateUsersMoneydetail(UsersMoneydetail usersMoneydetail)
    {
        return usersMoneydetailMapper.updateUsersMoneydetail(usersMoneydetail);
    }

    /**
     * 批量删除消费记录
     * 
     * @param ids 需要删除的消费记录主键
     * @return 结果
     */
    @Override
    public int deleteUsersMoneydetailByIds(String ids)
    {
        return usersMoneydetailMapper.deleteUsersMoneydetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除消费记录信息
     * 
     * @param id 消费记录主键
     * @return 结果
     */
    @Override
    public int deleteUsersMoneydetailById(Long id)
    {
        return usersMoneydetailMapper.deleteUsersMoneydetailById(id);
    }
}
